open FrCore

let @distrib0 f = @f
let @distrib1 f a = @(distrib0 f) @a
let @distrib2 f a b = @(distrib1 f a) @b
let @distrib3 f a b c = @(distrib2 f a b) @c

let lift0 f = distrib0 (lift f)
let lift1 f = distrib1 (lift f)
let lift2 f = distrib2 (lift f)
let lift3 f = distrib3 (lift f)

let @lift0' f = f
let @lift1' f a = @(lift0' f) @a
let @lift2' f a b = @(lift1' f a) @b
let @lift3' f a b c = @(lift2' f a b) @c

let @lift0 f = f
let @distrib1 f a = @f @a

let lift1 f a = distrib1 (lift0 f) a
let lift2 f a b = distrib1 (lift1 f a) b

let distrib2 f a b = distrib1 (distrib1 f a) b
let distrib3 f a b c = distrib1 (distrib2 f a b) c
